Design of Xml/edi SystemOverall frameworkThe Xml/edi system consists of four levels: The first tier is a service provider that provides a WEB service, It includes all the services that the service provider can provide (primarily the interaction with the database and the implementation of complex features) The thi
Spring Consolidated MyBatis is used in mybatis-spring, and mapperscannerconfigurer is typically used when configuring MyBatis mapping files. Mapperscannerconfigurer will automatically scan the Basepackage specified package, locate the mapping interface class and map the XML file, and inject it. The configuration is as follows:[HTML]View PlainCopy
Bean id=
the target properties you have already done. For example, if the Author table above already uses an automatically generated column type for the ID, the statement can be modified to: Insert into User (Id,username,password,email,bio) VALUES (#{id},#{username},#{password},#{email}) MyBatis there is another way to generate a primary key for a database that does not support auto-generated types, such as Oracle, or for JDBC drivers that might not support auto-generating primary keys. s
, because the collection of filter is a chain, so only the order of processing is different, and no one filter is selected. The filter is processed in the same order as the filter-mapping defined in Web. Xml. Second, Url-pattern detailedIn the Web. xml file, the following syntax is used to define the mappings:L. starting with "/ " and ending with "/* " are used f
the order of processing is different, and no one filter is selected. The filter is processed in the same order as the filter-mapping defined in Web. Xml. Second, Url-pattern detailed:In the Web. xml file, the following syntax is used to define the mappings:L. starting with "/ " and ending with "/* " are used for path mapping
The 2.4 version of the servlet specification adds a new Example 1:XML code
filter-mapping >
filter-name>loggingfilterfilter-name>
url-pattern>/ Products/*url-pattern>
Filter-mapping>
In this case, the filter will function directly from the client to/products/... The request started. Since there are no Example
completely loosely coupled with the servlet Container2.attribute-driven and model-driven get data from forms on the page3, the use of the concept of interceptors to the servlet container to overcome the first 4 shortcomings4,struts1+webwork=struts2A first exampleTo write the steps:1 Create a Web project2 Copy Web. Xml from the Struts jar package into the above project 3 Create an ordinary Java class, and we are accustomed to write the last word o
Explore mapped SQL statementsHere you may want to know exactly what was done with the sqlsession and Mapper objects. The mapped SQL statement is a big topic, and this topic runs through most of this document. Here are some examples to give a macroscopic overview . Any of the examples mentioned above, statements are defined by XML or annotations. Let's look at XML first. the use of
Inside the MyBatis framework, test on the DAO layer, the console display error is: Must declare the property "Resulttype" for the element type "Delete"The SQL statements for the corresponding. xml file are:The console's detailed error is:1. The attribute "Resulttype" must be declared for the element type "Delete"2.Check the data on the Internet to say that every _sqlmapper.xml file as far as possible in each SQL statement to a namespace (the complete
NHibernate development, must pass phase: Need entity and XML mapping, this section focuses on this piece of content.
For novice developers, how to map the database and XML mapping, is not cut, the following start introduction:
One: What is nhibernate mapping?
In fact,
collection of filter is a chain, so only the order of processing is different, and no one filter is selected. The filter is processed in the same order as the filter-mapping defined in Web. Xml.Second, Url-pattern detailedIn the Web. xml file, the following syntax is used to define the mappings:L. Starting with "/" and ending with "/*" are used for path mapping.
Write in front: There are two ways to configure the mapping of entity classes to databases:1. Using *.hbm.xml2. Use @ annotationsTwo: How to configure XML: Eg: an employee's XML configuration file:XML version= "1.0" encoding= "UTF-8"?>DOCTYPE hibernate-mapping Public '-//hibernate/hibernate
Usually our XML mapping file will be placed in the source code, the ordinary Java project at compile time can be the SRC under the XML in the classes file.But the MAVEN project compiles without putting the XML into the classes file, causing our mybatis-config.xml to find the corresponding
MappersSince MyBatis's behavior has been configured by the elements of the MyBatis configuration file described in the previous article, we are now going to define the SQL mapping statement. But first we need to tell MyBatis where to find these configurations. Java does not provide a good way to do this, so the best way is to tell MyBatis where to look for the mapping file. You can use a resource reference
objects (almost always a plain old Java object, or abbreviated as POJO) and XML documents.
For example, you might have a simple bean with several attributes, and your business needs to convert that Java object into an XML document. Spring's o/x Mapper can solve that problem for you. If, in turn, you need to convert an XML document into a simple Java bean,spring
XML mapping configuration fileThe XML configuration file for MyBatis contains settings and attribute information that affect mybatis behavior very deeply. The advanced hierarchy of XML documents is as follows:PropertiesSettingsThese and other important tweaks, he modifies the way MyBatis behaves at runtime. The followi
MyBatis Mapper XML file-mapping and parameters
The true strength of MyBatis lies in its mapping statement and its magic. Because of its exceptional power, the mapper's XML file appears relatively simple. If you compare it to a JDBC code that has the same functionality, you'll immediately find that you've skipped near
In our practical applications, the structure of XML is often more than that simple, generally there are 2, 3 layers. That is, if the mapping to an object is an aggregation (a combination).
With the example in our previous chapter, the simple author of our book is now more than a string name, an object author, and contains personal information about the author. So how do we make columns.
Look at the code dir
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.